# -*- coding: utf-8 -*- 
# @project : 《Atcoder》
# @Author : created by bensonrachel on 2021/8/18
# @File : TPM（step2）D. Number of Segments with Big Sum.py
def TPM():
    l = 0
    sum = 0
    res = 0
    for r in range(n):
        sum += rate[r]
        while (sum - rate[l] >= s):
            sum -= rate[l]
            l += 1
        if (sum >= s):
            res += (l + 1)
    return res
"""
枚举r,维护一个最大的l,满足[l,r]>=s,
此时[l-1,r],[l-2,r],,,[1,r],[0,r]一定也满足条件,
左端点的取值为[0,l],因此答案累加l+1.

"""

if __name__ == "__main__":
    n, s = map(int, input().split())
    rate = [int(i) for i in input().split()]
    print(TPM())
